package com.example.guesswho

import android.app.Application
import com.tencent.bugly.Bugly
import com.tencent.bugly.crashreport.CrashReport

/**
 * GuessWho Application class for initializing Parse and Bugly crash reporting
 */
class GuessWhoApplication : Application() {
    
    override fun onCreate() {
        super.onCreate()
        
        // Initialize Parse client
        ParseClient.initialize(this)
        
        // Initialize Bugly with your APP_ID
        // Replace "YOUR_BUGLY_APP_ID" with your actual Bugly APP_ID
        Bugly.init(applicationContext, "YOUR_BUGLY_APP_ID", true)
        
        // Additional Bugly configuration
        val strategy = CrashReport.UserStrategy(applicationContext)
        strategy.setAppVersion(BuildConfig.VERSION_NAME)
        strategy.setAppChannel("Google Play")
        strategy.setAppPackageName(packageName)
        
        // Enable debug mode for development
        strategy.setDebugMode(BuildConfig.DEBUG)
        
        // Set user identifier (optional)
        strategy.setUserID("user_${System.currentTimeMillis()}")
        
        // Initialize CrashReport with custom strategy
        CrashReport.initCrashReport(applicationContext, "YOUR_BUGLY_APP_ID", true, strategy)
    }
}